//
//  MyWinViewController.m
//  CarTown
//
//  Created by xionghao on 15/8/28.
//  Copyright (c) 2015年 熊浩. All rights reserved.
//

#import "MyWinViewController.h"
#import "HYSegmentedControl.h"
#import "BottomBar.h"
#import "MyWinTableViewCell.h"
#import "QibiaoTableViewController.h"
@interface MyWinViewController ()
<UIScrollViewDelegate,HYSegmentedControlDelegate,UITableViewDataSource,UITableViewDelegate>
{
    BOOL _isedting;
}
@property (nonatomic,strong) HYSegmentedControl *hysegment;

@property (nonatomic,strong) UIScrollView *scrollview;
@property (nonatomic,strong) UITableView *tablview;

@end

@implementation MyWinViewController

+(instancetype)ViewController{
    MyWinViewController *mywin=[[MyWinViewController alloc]init];
    mywin.hidesBottomBarWhenPushed=YES;
    return mywin;
}

- (void)viewDidLoad {
    [super viewDidLoad];
    self.view.backgroundColor=bgGarycolor;
    self.automaticallyAdjustsScrollViewInsets=NO;
    self.hysegment=[[HYSegmentedControl alloc]initWithOriginY:120 Titles:@[@"全部",@"进行中",@"中标",@"成交",@"流标",@"待付款"] delegate:self];
    [self.view addSubview:self.hysegment];
    self.navigationItem.title=@"我的车源";
    [self setupview];
    // Do any additional setup after loading the view.
}

-(void)setupview{
    //初始化搜索框
    UIView *view=[[UIView alloc]initWithFrame:CGRectMake(0, 64, XHScreenwidth, 56)];
    UISearchBar *search=[[UISearchBar alloc]initWithFrame:CGRectMake(10, 10, XHScreenwidth-20, 36)];
    search.backgroundImage=[UIImage imageWithStretchableName:@"searchbar_textfield_background"];
    search.placeholder=@"可输入车型、价格、颜色、配置..";
    [view addSubview:search];
    [self.view addSubview:view];
    UITableView *tablview=[[UITableView alloc]initWithFrame:CGRectMake(0, 156, XHScreenwidth, XHScreenheight-156) style:UITableViewStylePlain];
    tablview.delegate=self;
    tablview.dataSource=self;
    [self.view addSubview:tablview];
    self.tablview=tablview;
    
    UINib *nib=[UINib nibWithNibName:NSStringFromClass([MyWinTableViewCell class]) bundle:nil];
    
    [self.tablview registerNib:nib forCellReuseIdentifier:@"mywin"];
    self.tablview.rowHeight=126;
    self.tablview.backgroundColor=bgGarycolor;

    
}
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
    QibiaoTableViewController *qbvc=[QibiaoTableViewController viewController];
    [self.navigationController pushViewController:qbvc animated:YES];
}

-(void)hySegmentedControlSelectAtIndex:(NSInteger)index{
    NSLog(@"%ld",index);
}
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
    return 10;
}

-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    MyWinTableViewCell *cell=[MyWinTableViewCell cellWithTableView:tableView];
    return cell;
    
}
/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
